package com.example.demo.controller;

import com.example.demo.producer.MessageProducer;
import com.example.demo.producer.NumberDemo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/message")
public class MessageController {

    @Autowired
    private MessageProducer messageProducer;
    @Autowired
    private NumberDemo numberDemo;

    @PostMapping("/send")
    public String sendMessage(@RequestParam String message, @RequestParam int delayTime) {
        messageProducer.sendDelayedMessage(message, delayTime * 1000);
        return "消息已发送: " + message;
    }
    @GetMapping("/calc/{num}")
    public void calculate(@PathVariable Integer num ){
        numberDemo.calcNum(num);
    }
    public void B(){}
    public void C(){}
    public void E(){}
    public void D(){}

    public void G(){}

     public void F(){}
}